package com.lhy.wcss.web.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.lhy.wcss.common.JsonResponse;
import com.lhy.wcss.service.RoleFlowSettingService;
import com.lhy.wcss.model.domain.RoleFlowSetting;


@Controller
@RequestMapping("/roleFlowSetting")
public class RoleFlowSettingController {

    private final Logger logger = LoggerFactory.getLogger( RoleFlowSettingController.class );

    @Autowired
    private RoleFlowSettingService roleFlowSettingService;

    /**
    * 描述：根据Id 查询
    *
    */
    @RequestMapping(value = "/{id}", method = RequestMethod.GET)
    @ResponseBody
    public JsonResponse getById(@PathVariable("id") Long id)throws Exception {
        RoleFlowSetting  roleFlowSetting =  roleFlowSettingService.getById(id);
        return JsonResponse.success(roleFlowSetting);
    }

    /**
    * 描述：根据Id删除
    *
    */
    @RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
    @ResponseBody
    public JsonResponse deleteById(@PathVariable("id") Long id) throws Exception {
        roleFlowSettingService.removeById(id);
        return JsonResponse.success(null);
    }


    /**
    * 描述：根据Id 更新
    *
    */
    @RequestMapping(value = "/{id}", method = RequestMethod.PUT)
    @ResponseBody
    public JsonResponse updateRoleFlowSetting(@PathVariable("id") Long  id,RoleFlowSetting  roleFlowSetting) throws Exception {
        roleFlowSetting.setId(id);
        roleFlowSettingService.updateById(roleFlowSetting);
        return JsonResponse.success(null);
    }


    /**
    * 描述:创建RoleFlowSetting
    *
    */
    @RequestMapping(value = "", method = RequestMethod.POST)
    @ResponseBody
    public JsonResponse create(RoleFlowSetting  roleFlowSetting) throws Exception {
        roleFlowSettingService.save(roleFlowSetting);
        return JsonResponse.success(null);
    }
}

